<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li ><a href="{:U('Box/add_box')}">添加智能柜</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('Club/add')}">
			<fieldset>
				<div class="control-group">
					<label class="control-label">球房ID</label>
					<div class="controls">
						<input type="number" name="id" required="required" value="{$id}" min="1">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">球房名称</label>
					<div class="controls" id="club-name">
						<input type="text" name="name" required="required" value="{$club_name}" readonly="readonly">
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">编号</label>
					<div class="controls">
						<input type="text" name="number" required="required">
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">锁数量</label>
					<div class="controls">
						<input type="number" name="luck_count" required="required"  min="8" max="16" value="16">
					</div>
				</div>

			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn  btn-danger js-ajax-submit">{:L('ADD')}</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
    
    <script type="text/javascript">
        $('input[name=id]').change(function(){
       	    var id  = $(this).val();
       	    var url = "{:U('Club/get_club_name')}";
       	    $.get(url,{id:id},function(data){
       	    	if(data.status == 1) {
       	    		//var str = '<input type="text" name="name" required="required" value="'+data.name+'" readonly="readonly">';
       	    		//$("#club-name").html(str);
       	    		$("input[name=name]").val(data.name)
       	    	}else{
       	    		alert('不存在球房的id');
       	    		$('input[name=id]').val('');
       	    		$('input[name=name]').val('');
       	    	}
       	    })
        })
    </script>
</body>
</html>